package com.hdax.dmw.scheduler.mapstruct;

import com.hdax.dmw.dtos.scheduler.SchedulerSeatDto;
import com.hdax.dmw.entity.scheduler.DmSchedulerSeat;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface SeatInfoMapper {

    @Mappings({
            @Mapping(target = "areaLevel",expression = "java(getAreaLevelName(source.getAreaLevel()))")
    })
    SchedulerSeatDto.SeatInfo toTarget(DmSchedulerSeat source);
    List<SchedulerSeatDto.SeatInfo> toTargetList(List<DmSchedulerSeat> sources);

    default String getAreaLevelName(Integer areaLevel){
        switch (areaLevel){
            case 1:
                return "A";
            case 2:
                return "B";
            case 3:
                return "C";
            default:
                return "";
        }
    }

}
